package com.jianying;

import javax.annotation.Resource;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

	@Resource
	private AuthInitInterceptor authInitInterceptor;

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(authInitInterceptor);
		registry.addInterceptor(localeChangeInterceptor());
	}

	public AuthInitInterceptor getAuthInitInterceptor() {
		return authInitInterceptor;
	}

	public void setAuthInitInterceptor(AuthInitInterceptor authInitInterceptor) {
		this.authInitInterceptor = authInitInterceptor;
	}
	
	public LocaleChangeInterceptor localeChangeInterceptor() {
        LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
        // 参数名
        lci.setParamName("lang");
        return lci;
    }



}
